import {
	defineStore
} from 'pinia'
import {
	ref,
	computed
} from 'vue'

const storeSetup = () => {
	/* 定义数据--------------------------------------------------------------------- */
	
	// 免登码
	const loginCode = ref("")
	
	// 当前的openId
	const currentOpenId =ref("") 
	
	// 用户信息
	const userInfo = ref({
	})
	
	// 注册信息
	const registerInfo = ref({
		openId:"",
		userProfilePicture:"",
		userPhone:"",
		userNearName:""
	})
	
	// session_key
	const sessionKey = ref('')
	
	
	// 是否已经创建名片
	const isCreateBusinessCard = ref(false)
	
	// 是否登录
	const isLogin = ref(false)

	/* 定义函数--------------------------------------------------------------------- */

	// 返回参数
	return {
		userInfo,
		registerInfo,
		isLogin,
		loginCode,
		currentOpenId,
		sessionKey,
		isCreateBusinessCard
	}
}

// 导出Store
export const useUserStore = defineStore('user', storeSetup)